//
//  OPBoardStructure.h
//  OPFramework
//
//  Created by malcom on 7/13/08.
//  Copyright 2008 malcom-mac software. All rights reserved.
//

/*!
    @class		 OPBoardStructure
    @abstract    This class contains the entire forum structure (but not the OPUser objects).
	@discussion  Board structure contains the hierarchical tree of connected forum (you can read it by reading the <i>_rootNode</i><br/>
				 property. You can use this tree to draw the forum hierarchy in your client GUI.<br/>
				 If you need to get a forum object you can use one of the available accessor methods.<br/>
				 In fact you will use OPBoardStructure directly onyl when you need to get some forum object or during the initial ui draw.<br/>
*/


#import <Foundation/Foundation.h>
#import "OPBaseObject.h"
#import "OPForum.h"

@interface OPBoardStructure : OPBaseObject {
	OPForum		*_rootNode;
}

@property (readonly) OPForum *_rootNode;

/*!
    @method     getForumFromID:
    @abstract   This method returns an OPForum object by giving the unique id number.
    @param		_id the id of the forum to return
	@result		OPForum or nil if the given id does not exist in this forum structure
*/

- (OPForum *) getForumFromID:(NSNumber *) _id;

/*!
 @method     getForumFromName:
 @abstract   This method returns an OPForum object by giving it's name (remember, the name could be not unique).
 @param		_name the name of the forum to return
 @result	OPForum or nil if the given name does not exist in this forum structure
 */
- (OPForum *) getForumFromName:(NSString *) _name;

/*!
    @method     getFlatNormalForumsList
    @abstract   Return a flat list of available forums of the board
    @discussion If you need to get a flat list (not the standard hierarchical one you can found reading _rootNode property
				you can use this method. It will return a plain NSArray with OPForum objects.
	@return		an NSArray with OPForum objects.
*/

- (NSArray *) getFlatNormalForumsList;

#pragma mark PRIVATE METHODS
- (void) _loadStructure:(NSArray *) _result;
- (void) _loadObject:(NSDictionary *) _fList asChildOf:(OPForum *) _forum;
- (OPForum *) _getForumSearchByWhat:(int) _type withValue:(id) _value inList:(NSArray *) _list;
- (void) _browseForum:(NSArray *) _list addingForumTo:(NSMutableArray *) _finalList;

@end
